package org.sample.vm.oom;

/**
 * VM stack overflow.
 * 
 * VM Args: -Xss128k
 */

public class VMStackSOF {

	private int stackLength = 1;

	public void stackLeak() {
		stackLength++;
		stackLeak();
	}

	public static void main(String[] args) throws Throwable {
		VMStackSOF sof = new VMStackSOF();
		try {
			sof.stackLeak();
		} catch (Throwable e) {
			System.out.println("stack length: " + sof.stackLength);
			throw e;
		}
	}

}
